//
//  Common.h
//  iAPHD
//
//  Created by 曹兴星 on 13-6-9.
//  Copyright (c) 2013年 曹兴星. All rights reserved.
//

@interface Common : NSObject
/*==============================公用方法============================================*/


/*==============================系统相关===========================*/
//获取当前软件版本
+ (NSString *)getCurrentAppVersion;
//获取当前软件名称
+ (NSString *)getCurrentAppName;
//拨打电话
+ (BOOL)makeCall:(NSString *)telno;
//获取mac地址
+ (NSString *)getMacAddress;


/*==============================时间相关===========================*/
//获取系统当前时间
+ (NSString *)getCurrentTimeFormat:(NSString *)formatStr;
//根据时间戳转换成时间
+ (NSString *)timeIntervalSince1970:(NSTimeInterval)secs Format:(NSString*)formatStr;
//String ====> Date  （字符串转时间）
+ (NSDate *)dateFromString:(NSString *)dateString Formater:(NSString *)formater;
//Date =====> String （时间转字符串）
+ (NSString *)stringFromDate:(NSDate *)date Formater:(NSString *)formater;
//距离现在的天、时、分、秒
+ (NSString *)compareCurrentTime:(NSTimeInterval) interval;

/*==============================正则匹配===========================*/
//手机号码的合法性
+ (BOOL)isMobileNumber:(NSString *)mobileNum;
//邮箱的合法性
+ (BOOL)isEmail:(NSString *)emailAddress;
//过滤特殊字符
+ (BOOL)isCharacter:(NSString *)characterNum;
//检测是否是纯数字
+ (BOOL)isAllNum:(NSString *)string;
/*==============================加密解密===========================*/

/*==============================字符串处理===========================*/
//检查是否空字符串
+ (BOOL)isEmptyString:(NSString *)sourceStr;
//过滤html标签
+ (NSString *)flattenHTML:(NSString *)html;

/*==============================UI相关===========================*/
//去除UITableView多余分割线
+ (void)removeExtraCellLines:(UITableView *)tableView;

//生成绘制图片
+ (UIImage *)drawImageSize:(CGSize)size
                     Color:(UIColor *)color;

//根据16进制显示颜色
+ (UIColor *)colorFromHexRGB:(NSString *)inColorString;
//改变图片大小
+ (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize;
//生成BarItem
+ (UIBarButtonItem *)createBarItemWithTitle:(NSString *)name
                                     Nimage:(UIImage *)nImg
                                     Himage:(UIImage *)hImg
                                       Size:(CGSize)size
                                   Selector:(void (^)())block;
/*==============================System相关===========================*/
//dic 转 json 字符串

+(NSString *)dictoJson:(NSDictionary *)dic;

//json 转 arr
+(NSDictionary *)jsontoArray:(NSString *)str;

+(NSArray *)jsontoArr:(NSString *)str;

+(NSString *)hostidtostring:(NSInteger )hostid Metuod:(NSString *)method;

+(NSString *)hostidtoFalsestring:(NSInteger )hostid Metuod:(NSString *)method;

+(NSString *)tcpDrawingstring:(NSInteger )hostid Metuod:(NSString *)method Param:(NSString *)param Type:(NSString *)type;

+(NSString *)tcpStartEnDevDrastring:(NSInteger )hostid Metuod:(NSString *)method;

+(NSString *)tcpDrawXYstring:(NSInteger )hostid Metuod:(NSString *)method X:(CGFloat)x Y:(CGFloat)y;

+(NSString *)performEventstring:(NSInteger )hostid Metuod:(NSString *)method Value:(NSString *)value Events:(NSString *)events;
+(NSString *)closeEvent:(NSInteger )hostid Metuod:(NSString *)method;

+(NSString *)tcpDrawPonitstring:(NSInteger )hostid Metuod:(NSString *)method Fpoint:(CGPoint)fp Spoint:(CGPoint)sp  Tpoint:(CGPoint)tp;
//+(NSString *)tcpDrawPonitstring:(NSInteger )hostid Metuod:(NSString *)method Fpoint:(CGPoint)fp Spoint:(CGPoint)sp Tpoint:(CGPoint)tp Hpoint:(CGPoint)hp;

//+(NSString *)tcpDrawPonitstring:(NSInteger )hostid Metuod:(NSString *)method Fpoint:(CGPoint)fp Spoint:(CGPoint)sp Tpoint:(CGPoint)tp Hpoint:(CGPoint)hp
//                        Fpoint1:(CGPoint)fp1 Spoint1:(CGPoint)sp1 Tpoint1:(CGPoint)tp1 Hpoint1:(CGPoint)hp1;

//+(NSString *)tcpDrawPonitSECstring:(NSInteger )hostid Metuod:(NSString *)method Fpoint:(CGPoint)fp Spoint:(CGPoint)sp;
+(NSString *)tcpDrawPonitSECstring:(NSInteger )hostid Metuod:(NSString *)method Fpoint:(CGPoint)fp Spoint:(CGPoint)sp Tpoint:(CGPoint)tp Hpoint:(CGPoint)hp;

+(NSString *)tcpDrawPonitBEstring:(NSInteger )hostid Metuod:(NSString *)method Fpoint:(CGPoint)fp;
@end
